<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>函数简写</title>
    <script src="../../package/vue/dist/vue.js">
    </script>
    <!-- 
    在很多时候，你可能想在bind和update时触发相同行为，而不关心其他的钩子
     -->
</head>

<body>
    <div id="app">
        <div v-colorswitch:[color]>111</div>

    </div>
    <script>
        Vue.directive('colorswitch', function(el, binding) {
                el.style.backgroundColor = binding.arg
            }

        )
        new Vue({
            el: '#app',
            data: function() {
                return {
                    color: "red",
                    name: {
                        namea: "aa"
                    }
                }
            },
            created() {
                console.log(this.name)
            }
        })
    </script>
</body>

</html>